package com.cskaoyan.shopping.service.remote;

import com.cskaoyan.mall.api.OrderProductService;
import com.cskaoyan.mall.dto.ClearCartItemRequest;
import com.cskaoyan.mall.dto.ClearCartItemResponse;
import com.cskaoyan.mall.dto.ProductDetailRequest;
import com.cskaoyan.mall.dto.ProductDetailResponse;
import com.cskaoyan.shopping.constants.GlobalConstants;
import com.cskaoyan.shopping.service.ICartService;
import com.cskaoyan.shopping.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @auther cskaoyan
 * @date 2022/7/28:17:17
 */
@RestController
public class OrderProductServiceImpl  implements OrderProductService {

    @Autowired
    ICartService iCartService;

    @Autowired
    IProductService iProductService;
    /**
     * 下单后清空购物车
     *
     * @author: 叶熠彬
     * @date: 2022/7/30 16:41
     * @param: [request]
     * @return: com.cskaoyan.mall.dto.ClearCartItemResponse
     */
    @RequestMapping(value = "/rpc/items", method = RequestMethod.DELETE)
    public ClearCartItemResponse clearCartItemByUserID(@RequestBody ClearCartItemRequest request) {
        return iCartService.clearCartItemByUserID(request);
    }


    public ProductDetailResponse getProductDetail(@RequestBody ProductDetailRequest request) {
        return iProductService.getProductDetail(request);
    }
}
